<!--
 * @Author: 詹真琦(legendryztachi@gmail.com)
 * @Date: 2022-05-17 11:24:59
 * @LastEditors: 詹真琦(legendryztachi@gmail.com)
 * @LastEditTime: 2022-07-20 15:03:26
 * @FilePath: \code\ctp-static-portal-front\src\components\Bulletin\index.vue
 * @Description: 
-->
<template>
  <div class="bulletin-panel" :style="name === 'Scroll' ? `padding:0` : ''">
    <component
      :is="name"
      :list="dataList"
      :options="sectionData.options"
      :sectionData="sectionData"
      :sectionStyle="sectionStyle"
      :contentHeight="contentHeight"
      path="/bulletin."
    />
  </div>
</template>

<script>
  import List from '../news/components/list.vue';
  import Scroll from './components/scroll.vue';
  import Abstract from './components/abstract.vue';
  import { methods } from '@/utils';
  export default {
    name: 'Bulletin',
    components: {
      List,
      Scroll,
      Abstract,
    },
    props: {
      dataList: {
        type: Array,
      },
      sectionData: {
        type: Object,
        default: () => ({}),
      },
      sectionStyle: {
        type: Object,
        default: () => ({}),
      },
      // card: {},
      // contentWidth: {},
    },
    data() {
      return {
        contentHeight: methods.getContentHeight(this.sectionData.options),
        name: '',
      };
    },
    created() {
      this.name = this.getName();
    },
    methods: {
      getName() {
        switch (this.sectionData.data.resolveFunction) {
          case 'multiRowThreeColumnTemplete':
            return 'List';
          case 'singleScrollTemplete':
          case 'singleScrollTempleteNormal':
            return 'Scroll';
          case 'pictureTitleAndBriefTemplete':
            return 'Abstract';
        }
      },
    },
  };
</script>
<style scoped>
  .bulletin-panel {
    padding: 10px 15px;
  }
</style>
